<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .tab-nav {
        list-style: none;
        display: flex;
        margin: 0;
        padding: 0;
      }
      .tab-nav li {
        cursor: pointer;
        padding: 10px;
      }
      .tab-nav li.active {
        border-bottom: 2px solid #000;
      }
      .tab-content {
        padding: 10px;
        border: 1px solid #000;
      }
      .tab-content div {
        display: none;
      }
      .tab-content div.active {
        display: block;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <ul class="tab-nav">
        <li
          v-for="(tab,index) in tabs"
          :class="{active:activeindex===index}"
          @click="selectTab(index)"
        >
          {{tab}}
        </li>
      </ul>
      <div class="tab-content">
        <div
          v-for="(tab,index) in tabs"
          :class="{active:activeindex===index}"
        ></div>
        {{tabContent[index]}}
      </div>
    </div>
    <script src="./js/vue.js"></script>
    <script>
      new Vue({
        el: '#app',
        data: {
          activeindex: 0,
          tabs: ['tab1', 'tab2', 'tab3'],
          tabContent: [
            'this is tab1 content',
            'this is tab2 content',
            'this is tab3 content'
          ]
        },
        methods: {
          selectTab(index) {
            this.activeindex = index
          }
        }
      })
    </script>
  </body>
</html>
